UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MFyx7pJh2PyqQbYUbfgm6uPG3jWfx1KoBNAic6hbHfw='
WHERE
key_id = 'bae02e8a7e566c5814ca52f7cfb7d1ef0dc187f796b2875810212469ca0e20d1'
AND (
token = 'MFyx7pJh2PyqQbYUbfgm6uPG3jWfx1KoBNAic6hbHfw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)