UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HhNLb5u2qOODe2Y6SRLaXp0ISM39XelHUBUpclP8xwM=' 
WHERE 
  key_id = '4e4244e9be062c9d9df1983196ee258f7667c334d78094cb86df91cb3da0da56' 
  AND (
    token = 'HhNLb5u2qOODe2Y6SRLaXp0ISM39XelHUBUpclP8xwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059