UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D+PyNNtKjDkVqxCINVrdSoHWrUgVuYhy1QmCdx0lFqg='
WHERE
key_id = 'e51292bd90b6bc76a019d207b8601fdb4b41c0a58f9e5c0d4d1a35ba3e2a6652'
AND (
token = 'D+PyNNtKjDkVqxCINVrdSoHWrUgVuYhy1QmCdx0lFqg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)