UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v5txIS3hHM8c6w30p926uPOnJCCmqnVYoOhU5pdezwI=' 
WHERE 
  key_id = '7788b6f875f95daab1d5c0f6813846b964ab0a2a17e95bad6458cd291e40be06' 
  AND (
    token = 'v5txIS3hHM8c6w30p926uPOnJCCmqnVYoOhU5pdezwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030