UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3cVq+taoZou8G/u8XyOg9mUMtp5gXTJH0ov7jQ21+ss=' 
WHERE 
  key_id = 'caf42654c72e34ce3f7ac9dd96098db88fba98023d110cef986f824e7f76b619' 
  AND (
    token = '3cVq+taoZou8G/u8XyOg9mUMtp5gXTJH0ov7jQ21+ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016