UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rm6bX2EIpWD9OBmPAU3qYDCevkTxYW0ndrgGV6Q3kPc='
WHERE
key_id = 'ad8eacf94f405387074493f8f34e2d2e3ac664caff5d830b1940b49a389d560b'
AND (
token = 'Rm6bX2EIpWD9OBmPAU3qYDCevkTxYW0ndrgGV6Q3kPc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)