UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b2nW9WoAf+3X+jlfebLm+FDDdIkyJQve+14mRQ3XVxU='
WHERE
key_id = '7d710d8a6f5f3a0c62b8306891e805fa01c38f4b45a9d2b46f573c9792a575e4'
AND (
token = 'b2nW9WoAf+3X+jlfebLm+FDDdIkyJQve+14mRQ3XVxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)