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