UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7RU8hQ0Vkfpj6opxKSTVqpGmtvJ8yDlumyH/4n69Dg='
WHERE
key_id = 'ea1ea32639ca54ea4ce14e082ed3cecbef2d4e2413db907bd94393a57db6be5c'
AND (
token = 'A7RU8hQ0Vkfpj6opxKSTVqpGmtvJ8yDlumyH/4n69Dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)