UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pmC4xOB8MF/sdRoSAmzqShi0G6MUh/nfsIl+bNTDhvc='
WHERE
key_id = 'e64f998b36bdd443023e731b05e03017bcad7a3154a4e80e065faabcdbaed003'
AND (
token = 'pmC4xOB8MF/sdRoSAmzqShi0G6MUh/nfsIl+bNTDhvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)