UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dGJbkoljGPKYkA1/uWcHIp5L+OlkRVlnGfOl0Tz0exs=' 
WHERE 
  key_id = '820fdfecc10bb7f22ba7cd82e5e4733e7ff6a8453c304d4e2df9f435753938cf' 
  AND (
    token = 'dGJbkoljGPKYkA1/uWcHIp5L+OlkRVlnGfOl0Tz0exs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039