UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'foJYp3b2iFkmix/aNhvFQbLN5xlbb86WjTvPijkTMVk='
WHERE
key_id = 'a0c70c6645d32fece91d1553084d187b62b7091bb04e494fdd2f1d84a55e13de'
AND (
token = 'foJYp3b2iFkmix/aNhvFQbLN5xlbb86WjTvPijkTMVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)