UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Iio0beKzm6lA+wy6tVY9MrGgv/Yp8FRNQruqc0dSPak='
WHERE
key_id = 'e4e27916762598ef1a3b87a23fdc937ea1ac5e80d312a9ed3b075a0ebb284796'
AND (
token = 'Iio0beKzm6lA+wy6tVY9MrGgv/Yp8FRNQruqc0dSPak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)