UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X72rDcuocyVddy8W7VHlj5t0MGP82DX/WdHei7wEu+w='
WHERE
key_id = '1cda994bcb56dfdfdb16b426d9819505e1a036dfe3aff018903e56a648b732ea'
AND (
token = 'X72rDcuocyVddy8W7VHlj5t0MGP82DX/WdHei7wEu+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)