UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mloXrbRz/7jlFxYcxcYiZci7jEZt4K7jf6F5W+aSHuQ='
WHERE
key_id = 'b0665fac5ac56806bab98c49486f3dd6697932a2dcc3454fdf799e48d3a1e6be'
AND (
token = 'mloXrbRz/7jlFxYcxcYiZci7jEZt4K7jf6F5W+aSHuQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)