UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R6jpttjM244Pfo/EJFF8my+c/qe5aWGYTTm3fOi6uE0='
WHERE
key_id = 'affec9b7a8a1c9b964847e463c87f94fbde6bdb209e7dc1ffd1668c76a3e8a22'
AND (
token = 'R6jpttjM244Pfo/EJFF8my+c/qe5aWGYTTm3fOi6uE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)