UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e4kMzgoWhGzN5fA3o78+A4yJHj0ZCa174s9cWBjmxgM=' 
WHERE 
  key_id = 'cc7cfac80336e5f064c410fff7feb3bf8343c890cabc7277165e249e865aa3e9' 
  AND (
    token = 'e4kMzgoWhGzN5fA3o78+A4yJHj0ZCa174s9cWBjmxgM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024