UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REnIcJMJfe5pehT3MxUZ3jDYQqJnoRVAYi7CeTJOEkM=' 
WHERE 
  key_id = 'a17583aab2df809e0c608d5ff0a678499bd62dd1f0aeef0f3331afc0409edf37' 
  AND (
    token = 'REnIcJMJfe5pehT3MxUZ3jDYQqJnoRVAYi7CeTJOEkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034