UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sx+qzKvoVSMXImvFu1gwTNNReorGFX85ZSGR07SOzGg='
WHERE
key_id = '3e22dc91b059d5170819d71bd0df34d796eca4a8f038d90dbf27dc99b621c4ed'
AND (
token = 'sx+qzKvoVSMXImvFu1gwTNNReorGFX85ZSGR07SOzGg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)