UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n/KWCHSB5W72wIb8eMnrOx42OO3TtsAA+dT8EG8A7uw='
WHERE
key_id = 'b67c93fce8b2ad0f0d16d622a94ab502bc7a5b6821e3a5578fb3e4c1df624c7b'
AND (
token = 'n/KWCHSB5W72wIb8eMnrOx42OO3TtsAA+dT8EG8A7uw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)