UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '85GLNO7Han/VsyYOVSepta6BVJbjyQ6B/ugYyUniYtY=' 
WHERE 
  key_id = '6c154a3c98903d36e7f0d56f7591d063b05b4fcc28511d4d6194ced9ccdf1ca6' 
  AND (
    token = '85GLNO7Han/VsyYOVSepta6BVJbjyQ6B/ugYyUniYtY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038