UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nRSdws5upOSoh+PDo1Eti7v1tBgqluFMejo92c0COSg='
WHERE
key_id = 'd4c7f9f77f1122d56638abf574f254aa5d945b98878b92e88e47f2ad9e4d52b8'
AND (
token = 'nRSdws5upOSoh+PDo1Eti7v1tBgqluFMejo92c0COSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)