UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oBKm+1lsTBG70M2cm1PyRujSDnNUskU3mgS/RdAdZ2g='
WHERE
key_id = 'b20d90f72bf0ba9b6cab3a90af5cd6141468ea2209e6fccc603dc7d06be7cccd'
AND (
token = 'oBKm+1lsTBG70M2cm1PyRujSDnNUskU3mgS/RdAdZ2g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)