UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LpN6bcCIoEUPUxY9OgYDyo2nxBjGnq2h1uUnP/orep0=' 
WHERE 
  key_id = 'b1b3270d78b724162e488b457fbf064e9eb20b71bafb5861f120f38ba31d0318' 
  AND (
    token = 'LpN6bcCIoEUPUxY9OgYDyo2nxBjGnq2h1uUnP/orep0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024