UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xVeKLbczKagi775/F0E7HpQZX7h7d6NS+TzFDdo48JU=' 
WHERE 
  key_id = '27e56a3684abd0cf169a7bc539eacbbd45bd9283bd69a6959cb1fba2dd4b7159' 
  AND (
    token = 'xVeKLbczKagi775/F0E7HpQZX7h7d6NS+TzFDdo48JU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040