UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fcT0S4f0bqAnqzsWatL9UyHkMwYd8Flfn/dWXu76nj8='
WHERE
key_id = 'aeffe5490c177b6e613ed47ad27361458b18ce497d4cd98326e51736d122abc9'
AND (
token = 'fcT0S4f0bqAnqzsWatL9UyHkMwYd8Flfn/dWXu76nj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)