UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o9GvN4ayIGjJrGutRRK349w8k6OnAxmjQU3WUwkFHdk='
WHERE
key_id = '4142455fd5c1c7b19ed7a771a224e88367a781b50bc6f219fc5d3c10d143553c'
AND (
token = 'o9GvN4ayIGjJrGutRRK349w8k6OnAxmjQU3WUwkFHdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)