UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YqSqkiKbxz2C3ZWiLlNDtSi+0qFQuu7mFEDG5AfjvYA='
WHERE
key_id = 'a3043377f4d81b7e9884cb9d246ec312bcda2e55b0c7208ce78244088e85d5ed'
AND (
token = 'YqSqkiKbxz2C3ZWiLlNDtSi+0qFQuu7mFEDG5AfjvYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)