UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yc4x5HOk+m3Jr4HiMLqd5L9zJY7A4DdZ3m5KahpIGgk=' 
WHERE 
  key_id = '7bab986161a2750bab79c39ea1104569c9028ff4949e191c73f05c21a8c5713b' 
  AND (
    token = 'yc4x5HOk+m3Jr4HiMLqd5L9zJY7A4DdZ3m5KahpIGgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032