UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'udhOrssDTYqAeDmKnekidk9iMXQiEdXPY0bUspeGJHA=' 
WHERE 
  key_id = '3bf2d708401deba643fedb357b5aac8cdb1308552c2fe867e99fd125bf2e1703' 
  AND (
    token = 'udhOrssDTYqAeDmKnekidk9iMXQiEdXPY0bUspeGJHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036