UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y9ZLfUc+cOOP6+isTAysFzJK3rn8ZUJb7/465wrv+Rg=' 
WHERE 
  key_id = '0eff3f4285bcccc172438aad889206c3e7e88b9bc3144fe8c3d59dd1563ef4f5' 
  AND (
    token = 'Y9ZLfUc+cOOP6+isTAysFzJK3rn8ZUJb7/465wrv+Rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046