UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n4LIdw/6z8E92O2jCQTeDV2Mvn9Xz6iigmKT7Hd9yJo='
WHERE
key_id = 'fcf7f0030462406ae54a04a60d0dcff4f619817b168e1cec5dea05cb2ccf7a54'
AND (
token = 'n4LIdw/6z8E92O2jCQTeDV2Mvn9Xz6iigmKT7Hd9yJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)