UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UW2vnbVLiFZjVnkat4EJpVq6+TKHK3Eh+C47CAOlWqU=' 
WHERE 
  key_id = '11fc3aa67f821a79a689b25a32996aabc34445648b10dac5f2fd75c8a28b4627' 
  AND (
    token = 'UW2vnbVLiFZjVnkat4EJpVq6+TKHK3Eh+C47CAOlWqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046