UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5oYqtxGjQOWWIFGkFbBxnJlUp6zsKX376G7OnVJvCKY=' 
WHERE 
  key_id = 'd15c7a71285537b694fe70de94ee2eb86755408a76991c75d830c36af630d946' 
  AND (
    token = '5oYqtxGjQOWWIFGkFbBxnJlUp6zsKX376G7OnVJvCKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034