UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T7SOa30Uqm9X+ypiQ8uzlf1CreKAuEeSkUghGmDXdZQ=' 
WHERE 
  key_id = '8caac37a9779edb36d7ee15d0f7964cdd8a5a3f60c7da439cfd796da22aa8e16' 
  AND (
    token = 'T7SOa30Uqm9X+ypiQ8uzlf1CreKAuEeSkUghGmDXdZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034