UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZchaQ+o2YnqJVXyHlbM4C5yrSIwmkbu1hOXkb31aQsA=' 
WHERE 
  key_id = '0ccaab39a1559dc517ad9cb3117b86fe5cb19b8920d50f3de7f165aab26f0aa3' 
  AND (
    token = 'ZchaQ+o2YnqJVXyHlbM4C5yrSIwmkbu1hOXkb31aQsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048