UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkTyy4gW3Jgmn/nTJLF241iHZkqQwlCd9gavvN/9LYs=' 
WHERE 
  key_id = 'd70330470bbd55b9ca82f60a26dfcd017fefa2a490cc09182aba25268af019fe' 
  AND (
    token = 'gkTyy4gW3Jgmn/nTJLF241iHZkqQwlCd9gavvN/9LYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043