UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RK/D4rYsY1+ri07hulgiFCaer7spkFg6uCF8xrQdyas=' 
WHERE 
  key_id = 'f38f42cf2e3e8e85bf34a3a4f1c199d38fe3f725655bde0d91557d2826cc6889' 
  AND (
    token = 'RK/D4rYsY1+ri07hulgiFCaer7spkFg6uCF8xrQdyas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041