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

Query time 0.00038