UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E9MFvP/suXJqDHv+1dAphBIxbG22uY39zEKrEojvp8s=' 
WHERE 
  key_id = '3eb4ddf862d86d3f39d24c147f6ef353446840c5adc6f31fe1ea9cb941acbb51' 
  AND (
    token = 'E9MFvP/suXJqDHv+1dAphBIxbG22uY39zEKrEojvp8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052