UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BSJ7ZWuU9tC0NFh+oaG6xZNw+1nVQIdki5OM2XlybxY=' 
WHERE 
  key_id = '981855568a5d05ef6830fc576a33ed74b64792783de7559d53257fef70fba054' 
  AND (
    token = 'BSJ7ZWuU9tC0NFh+oaG6xZNw+1nVQIdki5OM2XlybxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050