UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Afes7NhmM23lJ98T8sxWfOm7Z6dOSa17bzC92pmpy0k='
WHERE
key_id = '8f91ff2da9b6ddb6c40c6adc07e179dfb1c1f0de25a4ce5fe2f2d1cf1b6d7d88'
AND (
token = 'Afes7NhmM23lJ98T8sxWfOm7Z6dOSa17bzC92pmpy0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)