UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xJZ/T1zWOfPxQtO6e46TdZdhrJFVBDjFbfIO6LZ39kU='
WHERE
key_id = '768787c4d76e3e63e6488c6bc97ea99342d3c8d65b5e84331287b3fcf9d71f2d'
AND (
token = 'xJZ/T1zWOfPxQtO6e46TdZdhrJFVBDjFbfIO6LZ39kU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)