UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ewB9BQc5WqARc/QJ3lbcrgy5M7L5rkHuwtdA9Wri8iA=' 
WHERE 
  key_id = '99ce75ecd245b50f76dc994850d358c59f659dafb9ded4fc56a7ab610a3521bf' 
  AND (
    token = 'ewB9BQc5WqARc/QJ3lbcrgy5M7L5rkHuwtdA9Wri8iA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023