UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FQ/DgwRpI4OYbMF8MxRkj4bPKTppB2UcJRVqrQtgQ8g=' 
WHERE 
  key_id = '8ac7172857c53657c3eedb62b7158718dd2357a28a4759147fb6b8c9ce9bb712' 
  AND (
    token = 'FQ/DgwRpI4OYbMF8MxRkj4bPKTppB2UcJRVqrQtgQ8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026